using System.Threading.Tasks;
using Abp.Domain.Repositories;
using HCD.Hcd.Dtos;
using HCD.Entities;
using System.Linq;
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.Linq.Extensions;
using Microsoft.AspNetCore.Mvc;
using HCD.Const;

namespace HCD.Hcd
{
    /// <summary>
    /// 应用层服务的接口实现方法
    ///</summary>
    [Route("api/[controller]/[action]"), ApiController]
    public class UserScreeningDetailAppService : AsyncCrudAppService<UserScreeningDetail, UserScreeningDetailDto, long, UserScreeningDetailGetAllInput, UserScreeningDetailEditDto, UserScreeningDetailEditDto, EntityDto<long>, EntityDto<long>>, IUserScreeningDetailAppService
    {
        public UserScreeningDetailAppService(IRepository<UserScreeningDetail, long> repository)
        : base(repository)
        {
            LocalizationSourceName = EnterpriseConsts.LocalizationSourceName;
        }

        protected override IQueryable<UserScreeningDetail> CreateFilteredQuery(UserScreeningDetailGetAllInput input)
        {
            return base.CreateFilteredQuery(input)
                .WhereIf(!string.IsNullOrWhiteSpace(input.ScreeningName), t => t.ScreeningName == input.ScreeningName);
        }

        /// <summary>
        /// 新增用户筛选器明细记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost, ActionName("Add")]
        public override Task<UserScreeningDetailDto> CreateAsync(UserScreeningDetailEditDto input)
        {
            return base.CreateAsync(input);
        }

        /// <summary>
        /// 编辑用户筛选器明细记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut, ActionName("Edit")]
        public override Task<UserScreeningDetailDto> UpdateAsync(UserScreeningDetailEditDto input)
        {
            return base.UpdateAsync(input);
        }

        /// <summary>
        /// 删除用户筛选器明细记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpDelete, ActionName("Delete")]
        public override Task DeleteAsync(EntityDto<long> input)
        {
            return base.DeleteAsync(input);
        }

        /// <summary>
        /// 获取用户筛选器明细记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet, ActionName("Get")]
        public override Task<UserScreeningDetailDto> GetAsync(EntityDto<long> input)
        {
            return base.GetAsync(input);
        }

        /// <summary>
        /// 分页获取用户筛选器明细记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet,ActionName("GetList"), NonAction]
        public override Task<PagedResultDto<UserScreeningDetailDto>> GetAllAsync(UserScreeningDetailGetAllInput input)
        {
            return base.GetAllAsync(input);
        }
    }
}


